/**
 * @(#)ClientEffectServiceImpl.java 2017年6月21日
 * Copyright(C) 2017 ZHEXIN IT CO.,LTD. All rights reserved.
 */
package org.jsbd.boss.service.impl;

import javax.annotation.Resource;

import org.jsbd.boss.common.redis.RedisClient;
import org.jsbd.boss.domian.channel.UserClientInfo;
import org.jsbd.boss.enums.ApkBaseEnum;
import org.jsbd.boss.service.IClientEffectService;
import org.jsbd.boss.util.CacheKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * TODO 请加入本类的说明
 * 
 * @author <a href="mailto:xupengcheng@zhexinit.com" >徐鹏程</a>
 * @version 1.0.0
 */
@Service
public class ClientEffectServiceImpl implements IClientEffectService {
	public static final Logger LOGGER = LoggerFactory.getLogger(ClientEffectServiceImpl.class);

	@Resource
	private RedisClient redisClient;

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.jsbd.boss.service.IClientEffectService#selectUserClient(java.lang
	 * .Integer, java.lang.Integer)
	 */
	@Override
	public UserClientInfo selectUserClient(Integer provinceId, Integer base, Integer apkId) {
		int postfix = apkId;
		if (base != null && (base != ApkBaseEnum.OTHER.getType())) {
			postfix = base;
		}
		String queryKey = CacheKey.EFFECT_QUEUE + postfix + "_" + provinceId;
		return (UserClientInfo) redisClient.pollFromQueue(queryKey);
	}
}
